home *** CD-ROM | disk | FTP | other *** search
/ Megahits 5 / Megahits 5 (1994)(GTI - Rhein-Main-Soft)(DE)(Disc 2 of 2)[!].iso / archive / print / virtprinters2.lha / screen_printer_source / density.c < prev    next >
C/C++ Source or Header  |  1993-06-27  |  1KB  |  43 lines

  1. /***************************************************************************
  2.  *
  3.  *       Density module for Screen_Printer
  4.  */
  5.  
  6. #include <exec/types.h>
  7. #include <devices/printer.h>
  8. #include <devices/prtbase.h>
  9.  
  10. void SetDensity(ULONG density_code)
  11. {
  12.         extern struct PrinterData *PD;
  13.     extern struct PrinterExtendedData *PED;
  14.  
  15.         /* SPECIAL_DENSITY     0   1   2    3    4    5    6    7 */
  16.         static int XDPI[8] = {80, 80, 80, 120, 160, 180, 240, 300};
  17.     static int YDPI[8] = {68, 68, 80, 120, 136, 180, 240, 300};
  18.  
  19.     /* Set page size to defaults */
  20.     PED->ped_MaxColumns = 80;    /* 8.0" */
  21.     PED->ped_MaxYDots = 100;    /* 10.0" */
  22.     switch(PD->pd_Preferences.PaperSize) {
  23.         case W_TRACTOR:
  24.             PED->ped_MaxColumns = 136;    /* 13.6" x 10.0" */
  25.             break;
  26.         case US_LEGAL:
  27.             PED->ped_MaxYDots = 140;    /* 8.0" x 14.0" */
  28.             break;
  29.         case CUSTOM:
  30.             PED->ped_MaxColumns =
  31.                 PD->pd_Preferences.PrintMaxWidth;
  32.             PED->ped_MaxYDots =
  33.                 PD->pd_Preferences.PrintMaxHeight;
  34.             break;
  35.     }
  36.         density_code /= SPECIAL_DENSITY1;
  37.         PED->ped_MaxXDots =
  38.         XDPI[density_code] * PED->ped_MaxColumns / 10;
  39.         PED->ped_MaxYDots = YDPI[density_code] * PED->ped_MaxYDots / 10;
  40.         PED->ped_XDotsInch = XDPI[density_code];
  41.         PED->ped_YDotsInch = YDPI[density_code];
  42. }
  43.